<%@ include file="../init.jsp" %>

<%@ page import="java.util.List" %>
<%@ page import="uit.edu.vn.portal.elearning.models.assignment.*" %>
<%@ page import="uit.edu.vn.portal.elearning.logic.SakaiWSLogic" %>
<%@ page import="uit.edu.vn.portal.elearning.helper.SakaiWSHelper" %>
<%@ page import="java.util.Date" %>

<%
	List<Assignment> assignments = (List<Assignment>)request.getAttribute("assignments");
	String sakaiurl = application.getInitParameter("sakai.server.url");
	SakaiWSLogic logic = (SakaiWSLogic)request.getAttribute("logic");
%>
<table>
<tr>
	<th><liferay-ui:message key="assignment-title" /></th>
	<th><liferay-ui:message key="assignment-status" /></th>
	<th><liferay-ui:message key="assignment-open-time" /></th>
	<th><liferay-ui:message key="assignment-due-time" /></th>
	<th><liferay-ui:message key="assignment-course-title" /></th>
</tr>
<% 
	for(Assignment assignment:assignments ){ 
		String linktosakai = sakaiurl + assignment.getPageUrl();
		String site_title = SakaiWSHelper.getSiteTitle(logic,assignment.getSiteid());
		Date openTime = new Date(assignment.getOpenTime());
		Date dueTime = new Date(assignment.getDueTime());
%>
<tr>
	<td width="20%"><a href="<%= linktosakai %>"><%= assignment.getTitle()%></a></td>
	<td width="15%"><%= assignment.getStatus()%></td>
	<td width="15%"><%= openTime.toGMTString()%></td>
	<td width="15%"><%= dueTime.toGMTString()%></td>
	<td width="35%"><a href="<%= linktosakai %>"><%= site_title %></a></td>
</tr>
<% } %>
</table>


